﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
    <link href="../themes/default/easyui.css" rel="stylesheet" />
    <link href="../themes/icon.css" rel="stylesheet" />
    <script src="../jquery-easyui-1.4.3/jquery.min.js"></script>
    <script src="../jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script>
        $(function () {
            $("#btAdd").click(function () {
                $("#Store").dialog({ width: 500, height: 500 })
                    .dialog("setTitle", "新增礼品")
                    .dialog("open");
                $("#iframe").attr("src", "/Gift/insert.html");
            });
       
            $("#btRevise").click(function () {
            var row = $("#dg").datagrid("getSelected");
            if (row != null) {
                $("#Store").dialog({ width: 500, height: 500 })
               .dialog("setTitle", "编辑礼品")
               .dialog("open");
                $("#iframe").attr("src", "/Gift/Update.html");
            }
            else {
                $.messager.alert("提示", "请选择需要编辑的行", "warning");
            }
        });
            //绑定表格
        $('#dg').datagrid({
            url: "/Jquery-easyUI/demo/datagrid/datagrid_data1.json",
            toolbar: "#dg1",
            method: "get",
            pagination: true,
            rownumbers: true,
            singleSelect: true,
            columns: [[
                { field: 'productid', title: '等级编号', width: 100 },
                { field: 'productname', title: '等级名称', width: 100 },
                { field: 'unitcost', title: '所需最大积分', width: 100 },
                { field: 'status', title: '扣分比例', width: 100 },
                 { field: 'listprice', title: '折扣比例', width: 100 },
                   { field: 'attr1', title: 'xx', width: 100 },
                   { field: 'itemid', title: 'xx', width: 100 },
            ]]
        });
        $("#bb").pagination({
            total: 2000,
            pagaSize: 10
        });

            //点击删除
        $('#btDelete').click(function () {
            var row = $('#dg').datagrid('getSelected');
            if (row != null) {
                $.messager.confirm('确认', '您要删除这行数据吗？', function (r) {

                });
            }
            else {
                $.messager.alert("提示", "请选择需要删除的行", "warning");
            }
        })
            //按钮
        $('#btAdd').linkbutton({
            iconCls: 'icon-add'
        });
        $('#btDelete').linkbutton({
            iconCls: 'icon-edit'
        });
        $('#btRevise').linkbutton({
            iconCls: 'icon-remove'
        });
        });
      
    </script>
</head>
<body>
    <div>
        <a id="btAdd">添加</a>
        <a id="btDelete">删除</a>
        <a id="btRevise">修改</a><br />
    </div>
    <div class="easyui-panel add_content" data-options="fit:true,border:false,novalidate:true">
        <table id="dg"></table>
    </div>
    <div>
        <table id="dg"></table>
        
    </div>
    <div id="bb" style="background:#efefef;border:1px solid #ccc;"></div>
    <div id="Store" data-options="iconCls:'icon-save',resizable:true,modal:true">
        <iframe id="iframe" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
    </div>
</body>
</html>
